<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
 <head>
  <meta http-equiv="content-type" content="text/html; charset=UTF-8">
  <title>Get a file handler to the entry defined by its name (read only)</title>
<link media="all" rel="stylesheet" type="text/css" href="styles/03e73060321a0a848018724a6c83de7f-theme-base.css" />
<link media="all" rel="stylesheet" type="text/css" href="styles/03e73060321a0a848018724a6c83de7f-theme-medium.css" />

 </head>
 <body class="docs"><div class="navbar navbar-fixed-top">
  <div class="navbar-inner clearfix">
    <ul class="nav" style="width: 100%">
      <li style="float: left;"><a href="ziparchive.getstreamindex.html">« ZipArchive::getStreamIndex</a></li>
      <li style="float: right;"><a href="ziparchive.iscompressionmethoddupported.html">ZipArchive::isCompressionMethodSupported »</a></li>
    </ul>
  </div>
</div>
<div id="breadcrumbs" class="clearfix">
  <ul class="breadcrumbs-container">
    <li><a href="index.html">PHP Manual</a></li>
    <li><a href="class.ziparchive.html">ZipArchive</a></li>
    <li>Get a file handler to the entry defined by its name (read only)</li>
  </ul>
</div>
<div id="layout">
  <div id="layout-content"><div id="ziparchive.getstreamname" class="refentry">
 <div class="refnamediv">
  <h1 class="refname">ZipArchive::getStreamName</h1>
  <p class="verinfo">(PHP 8 &gt;= 8.2.0, PECL zip &gt;= 1.20.0)</p><p class="refpurpose"><span class="refname">ZipArchive::getStreamName</span> &mdash; <span class="dc-title">Get a file handler to the entry defined by its name (read only)</span></p>

 </div>
 <div class="refsect1 description" id="refsect1-ziparchive.getstreamname-description">
  <h3 class="title">说明</h3>
  <div class="methodsynopsis dc-description">
   <span class="modifier">public</span> <span class="methodname"><strong>ZipArchive::getStreamName</strong></span>(<span class="methodparam"><span class="type">string</span> <code class="parameter">$name</code></span>, <span class="methodparam"><span class="type">int</span> <code class="parameter">$flags</code><span class="initializer"> = 0</span></span>): <span class="type"><span class="type">resource</span>|<span class="type"><span class="type false">false</span></span></span></div>

  <p class="para rdfs-comment">
   Get a file handler to the entry defined by its name. For now, it only
   supports read operations.
  </p>
 </div>

 <div class="refsect1 parameters" id="refsect1-ziparchive.getstreamname-parameters">
  <h3 class="title">参数</h3>
  <p class="para">
   <dl>
    
     <dt>
<code class="parameter">name</code></dt>

     <dd>

      <p class="para">
       The name of the entry to use.
      </p>
     </dd>

    
    
     <dt>
<code class="parameter">flags</code></dt>

     <dd>

      <p class="para">
       If flags is set to <strong><code>ZipArchive::FL_UNCHANGED</code></strong>, the original unchanged
       stream is returned.
      </p>
     </dd>

    
   </dl>

  </p>
 </div>

 <div class="refsect1 returnvalues" id="refsect1-ziparchive.getstreamname-returnvalues">
  <h3 class="title">返回值</h3>
  <p class="para">
   Returns a file pointer (resource) on success 或者在失败时返回 <strong><code>false</code></strong>.
  </p>
 </div>

 <div class="refsect1 examples" id="refsect1-ziparchive.getstreamname-examples">
  <h3 class="title">范例</h3>
    <div class="example" id="example-852">
     <p><strong>示例 #1 Get the entry contents with <span class="function"><a href="function.fread.html" class="function">fread()</a></span> and store it</strong></p>
     <div class="example-contents">
<div class="phpcode"><code><span style="color: #000000">
<span style="color: #0000BB">&lt;?php<br />$contents&nbsp;</span><span style="color: #007700">=&nbsp;</span><span style="color: #DD0000">''</span><span style="color: #007700">;<br /></span><span style="color: #0000BB">$z&nbsp;</span><span style="color: #007700">=&nbsp;new&nbsp;</span><span style="color: #0000BB">ZipArchive</span><span style="color: #007700">();<br />if&nbsp;(</span><span style="color: #0000BB">$z</span><span style="color: #007700">-&gt;</span><span style="color: #0000BB">open</span><span style="color: #007700">(</span><span style="color: #DD0000">'test.zip'</span><span style="color: #007700">))&nbsp;{<br />&nbsp;&nbsp;&nbsp;&nbsp;</span><span style="color: #0000BB">$fp&nbsp;</span><span style="color: #007700">=&nbsp;</span><span style="color: #0000BB">$z</span><span style="color: #007700">-&gt;</span><span style="color: #0000BB">getStreamName</span><span style="color: #007700">(</span><span style="color: #DD0000">'test'</span><span style="color: #007700">,&nbsp;</span><span style="color: #0000BB">ZipArchive</span><span style="color: #007700">::</span><span style="color: #0000BB">FL_UNCHANGED</span><span style="color: #007700">);<br />&nbsp;&nbsp;&nbsp;&nbsp;if(!</span><span style="color: #0000BB">$fp</span><span style="color: #007700">)&nbsp;die(</span><span style="color: #0000BB">$z</span><span style="color: #007700">-&gt;</span><span style="color: #0000BB">getStatusString</span><span style="color: #007700">());<br /><br />&nbsp;&nbsp;&nbsp;&nbsp;echo&nbsp;</span><span style="color: #0000BB">stream_get_contents</span><span style="color: #007700">(</span><span style="color: #0000BB">$fp</span><span style="color: #007700">);<br /><br />&nbsp;&nbsp;&nbsp;&nbsp;</span><span style="color: #0000BB">fclose</span><span style="color: #007700">(</span><span style="color: #0000BB">$fp</span><span style="color: #007700">);<br />}<br /></span><span style="color: #0000BB">?&gt;</span>
</span>
</code></div>
     </div>

    </div>
   </div>


 <div class="refsect1 seealso" id="refsect1-ziparchive.getstreamname-seealso">
  <h3 class="title">参见</h3>
  <p class="para">
   <ul class="simplelist">
    <li class="member"><span class="methodname"><a href="ziparchive.getstreamindex.html" class="methodname" rel="rdfs-seeAlso">ZipArchive::getStreamIndex()</a> - Get a file handler to the entry defined by its index (read only)</span></li>
   </ul>
  </p>
 </div>


</div></div></div></body></html>